// Define your object model
import Realm from "realm";

const userId = "ganSmall"
export const schemaName = {
    UserInfo: "UserInfo" + userId,
    Wallet: "Wallet" + userId,
    RpcUrl: "RpcUrl" + userId,
    BrowserSearchLogs: "BrowserSearchLogs" + userId,
    FriendList: "FriendList" + userId,
    GroupList: "GroupList" + userId,
    FriendMsgSeq: "FriendMsgSeq" + userId,
    FriendMsgLis: "FriendMsgLis" + userId,
    GroupMsgSeq: "GroupMsgSeq" + userId,
    GroupMsgLis: "GroupMsgLis" + userId,
    GroupInfo: "GroupInfo" + userId,
    GroupMembers: "GroupMembers" + userId,
    GroupAdmins: "GroupAdmins" + userId,



    UserInfoList: "UserInfoList" + userId,
    MsgSeq: "MsgSeq" + userId,
    MsgLis: "MsgLis" + userId,



    WalletList: "WalletList" + userId,
    CurrentWalle: "CurrentWalle" + userId,
    RpcUrlList: "RpcUrlList" + userId,

    BrowserPopularLogs: "BrowserPopularLogs" + userId,
}
export class UserInfo extends Realm.Object {
    static schema = {
        name: schemaName.UserInfo,
        primaryKey: 'Id',
        properties: {
            Id: "int",
            Address: "string",
            Followers: { type: 'int', default: 0, optional: true },
            Following: { type: 'int', default: 0, optional: true },
            IsFollowing: { type: 'int', default: 0, optional: true },
            NickName: { type: 'string', default: "My", optional: true },
            CreatedAt: { type: 'string', default: "My", optional: true },
            ProfilePhoto: { type: 'string', default: "", optional: true },
            Status: { type: 'int', default: 0, optional: true },
            Tweet: { type: 'string', default: "0", optional: true },
            USDT: { type: 'string', default: "0", optional: true },
            UserLevel: { type: 'int', default: 0, optional: true },
            Token: "string",
            Current: { type: 'bool', default: false, optional: true },
        }
    }
}
export class FriendMsgSeq extends Realm.Object {
    static schema = {
        name: schemaName.FriendMsgSeq,
        primaryKey: 'UserId',
        properties: {
            Cur: 'int',
            Total: 'int',
            UserId: 'int',
        }
    }
}
export class GroupMsgSeq extends Realm.Object {
    static schema = {
        name: schemaName.GroupMsgSeq,
        primaryKey: '_id',
        properties: {
            _id: "uuid",
            G: { type: 'int', default: 1 },
            Cur: 'int',
            Total: 'int',
            UserId: 'int',
        }
    }
}
export class FriendMsgLis extends Realm.Object {
    static schema = {
        name: schemaName.FriendMsgLis,
        primaryKey: '_id',
        properties: {
            F: 'int',//发送者的用户id
            M: { type: 'string', default: "" },//具体消息
            MT: 'int',//消息类型，
            S: { type: 'int', default: -1, optional: true },//消息id索引  -1 自己发送
            T: 'int',//发送消息的时间戳
            _id: "uuid", //自定义key
            Unread: { type: 'int', default: 1, optional: true },//自定义未读
            SendState: { type: 'int', default: 0, optional: true },//自定义 0 正常 1 发送中 / 2发送失败 / 3已被删除
            UserId: 'int',//自定义 登录ID
            RedPacketId: { type: 'int', default: 0, optional: true },//自定义 红包Id
            RedPacketIdState: { type: 'int', default: 0, optional: true }//自定义 红包状态0未领取 1 已领取
        }
    }
}
export class GroupMsgLis extends Realm.Object {
    static schema = {
        name: schemaName.GroupMsgLis,
        primaryKey: '_id',
        properties: {
            G: 'int',//群id
            F: 'int',//发送者的用户id
            M: { type: 'string', default: "" },//具体消息
            MT: 'int',//消息类型，
            P: { type: 'string', default: "" },//头像
            R: { type: 'string', default: "" },//名称
            S: { type: 'int', default: -1, optional: true },//消息id索引  -1 自己发送
            T: 'int',//发送消息的时间戳
            _id: "uuid", //自定义key
            Unread: { type: 'int', default: 1, optional: true },//自定义未读
            SendState: { type: 'int', default: 0, optional: true },//自定义 0 正常 1 发送中 / 2发送失败 / 3已被删除
            UserId: 'int',//自定义 登录ID
            RedPacketId: { type: 'int', default: 0, optional: true },//自定义 红包Id
            RedPacketIdState: { type: 'int', default: 0, optional: true }//自定义 红包状态0未领取 1 已领取
        }
    }
}
export class FriendList extends Realm.Object {
    static schema = {
        name: schemaName.FriendList,
        primaryKey: 'F',
        properties: {
            F: "int",
            P: "string",
            R: 'string',
            S: 'int',
            UserId: 'int',
            State: { type: 'int', default: 1, optional: true },//自定义 0 删除 1 正常
        }
    }
}
export class GroupList extends Realm.Object {
    static schema = {
        name: schemaName.GroupList,
        primaryKey: 'G',
        properties: {
            G: "int",//群id
            L: "string",//图片
            R: 'string',//名称
            S: 'int',//当前索引
            U: 'int',//总消息
            UserId: 'int',
            State: { type: 'int', default: 1, optional: true },//
        }
    }
}
export class GroupInfo extends Realm.Object {
    static schema = {
        name: schemaName.GroupInfo,
        primaryKey: 'Id',
        properties: {
            Address: { type: 'string', default: "" },//群主地址
            Admins: { type: 'string', default: "" },//
            CreatedAt: { type: 'string', default: "" },//
            GroupLevel: { type: 'int', default: 0, optional: true },//群等级
            GroupName: { type: 'string', default: "" },//具体消息
            GroupValue: { type: 'int', default: 0, optional: true },//群名称
            Id: { type: 'int', default: 0, optional: true },//群ID
            Logo: { type: 'string', default: "" },//群图片
            Notice: { type: 'string', default: "" },//群公告
            Num: { type: 'int', default: 0, optional: true },//群成员数量
            OwnerId: { type: 'int', default: 0, optional: true },//拥有者Id
            SortValue: { type: 'int', default: 0, optional: true },//
            Status: { type: 'int', default: 0, optional: true },//群状态
            UserId: 'int',
        }
    }
}
export class GroupMembers extends Realm.Object {
    static schema = {
        name: schemaName.GroupMembers,
        primaryKey: '_G_I',
        properties: {
            _G_I: "string",//群id-用户Id
            G: "int",//群id
            I: "int",//用户iD
            P: "string",//图片
            R: 'string',//名称
            S: 'int',//
            UserId: 'int',
        }
    }
}
export class GroupAdmins extends Realm.Object {
    static schema = {
        name: schemaName.GroupAdmins,
        primaryKey: '_G_I',
        properties: {
            _G_I: "string",//群id-用户Id
            G: "int",//群id
            Address: { type: 'string', default: "" },
            CreatedAt: { type: 'string', default: "" },
            Followers: { type: 'int', default: 0, optional: true },
            Following: { type: 'int', default: 0, optional: true },
            Id: { type: 'int', default: 0, optional: true },
            IsFollowing: { type: 'int', default: 0, optional: true },
            NickName: { type: 'string', default: "" },
            ProfilePhoto: { type: 'string', default: "" },
            Status: { type: 'int', default: 0, optional: true },
            Tweet: { type: 'string', default: "" },
            USDT: { type: 'string', default: "" },
            UpdatedAt: { type: 'string', default: "" },
            UserLevel: { type: 'int', default: 0, optional: true },
            UserId: 'int',
        }
    }
}

export class WalletList extends Realm.Object {
    static schema = {
        name: schemaName.WalletList,
        primaryKey: '_id',
        properties: {
            _id: 'uuid',
            address: "string",
            keystore: "string",
            type: { type: 'int', default: 1 },//1 记组词 2key
            chainId: { type: 'int', default: 56 },
            name: { type: 'string', default: "BNB-1" },
            balance: { type: 'string', default: "0" },
            symbol: { type: 'string', default: "BNB" },
            decimals: { type: 'int', default: 18 },
            state: { type: 'int', default: 1 },//0删除 1正常
        }
    }
}
export class Wallet extends Realm.Object {
    static schema = {
        name: schemaName.Wallet,
        primaryKey: '_id',
        properties: {
            _id: 'uuid',
            address: "string",
            keystore: "string",
            type: { type: 'int', default: 1 },//1 记组词 2key
            chainId: { type: 'int', default: 56 },
            chainId: { type: 'int', default: 56 },
            name: { type: 'string', default: "BNB-1" },
            balance: { type: 'string', default: "0" },
            symbol: { type: 'string', default: "BNB" },
            decimals: { type: 'int', default: 18 },
            state: { type: 'int', default: 1 },//0删除 1正常
            current: { type: 'bool', default: false, optional: true },
        }
    }
}
export class RpcUrlList extends Realm.Object {
    static schema = {
        name: schemaName.RpcUrlList,
        primaryKey: '_id',
        properties: {
            _id: 'uuid',
            chainId: { type: 'int', default: 1 },
            rpcUrlName: "string",
            rpcUrl: "string",
        }
    }
}
export class RpcUrl extends Realm.Object {
    static schema = {
        name: schemaName.RpcUrl,
        primaryKey: '_id',
        properties: {
            _id: 'uuid',
            chainId: { type: 'int', default: 2 },
            rpcUrlName: "string",
            rpcUrl: "string",
            currentMark: { type: 'bool', default: false, optional: true },
            current: { type: 'bool', default: false, optional: true },
        }
    }
}
export class BrowserSearchLogs extends Realm.Object {
    static schema = {
        name: schemaName.BrowserSearchLogs,
        primaryKey: '_id',
        properties: {
            _id: 'uuid',
            url: "string",
            time: "int",
            title: { type: 'string', default: "", optional: true },
            icon: { type: 'string', default: "", optional: true },
            collect: { type: 'bool', default: false, optional: true },
        }
    }
}
export class BrowserPopularLogs extends Realm.Object {
    static schema = {
        name: schemaName.BrowserPopularLogs,
        primaryKey: '_id',
        properties: {
            _id: 'string',
            url: "string",
            time: "int",
            title: { type: 'string', default: "", optional: true },
            icon: { type: 'string', default: "", optional: true },
            collect: { type: 'bool', default: false, optional: true },
            chainId: { type: 'int', default: 1 },
        }
    }
}


export const Profile = [
    UserInfo,
    Wallet,
    RpcUrl,
    BrowserSearchLogs,
    FriendList,
    GroupList,
    FriendMsgSeq,
    FriendMsgLis,
    GroupMsgSeq,
    GroupMsgLis,
    GroupInfo,
    GroupMembers,
    GroupAdmins

    // FriendMsgSeq,
    // GroupMsgSeq,
    // MsgLis,
    // GroupMsgLis,
    // FriendList,
    // GroupList,
    // GroupInfo,
    // GroupMembers,
    // WalletList,
    // RpcUrlList,
    // BrowserSearchLogs,
    // BrowserPopularLogs,
]